<?php

namespace module\app\validate;

use app\Validate;

class DynamicAlbum extends Validate
{
    /**
     * 所有验证场景需要的字段.
     *
     * @var array<array>
     */
    protected $scene = [
        'read' => ['id'],
        'index' => ['status', 'page', 'pageSize'],
        'save' => ['src', 'serial']
    ];
    /**
     * Get the validation rules that apply to the request.
     *
     * @var array<string>
     */
    protected $rule = [
        'id' => 'require|integer',  // ID
        'src' => 'requireWithout:id|max:80',
        'serial' => 'integer|<:10|>:0',
        'status' => 'integer|in:0,1,2',
        'page' => 'integer|>:0',
        'pageSize' => 'integer|>:0',
    ];
    /**
     * 验证字段描述
     * 
     * @var array<string>
     */
    protected $field = [
        'id' => 'ID',
        'src' => '图片',
        'serial' => '排序',
        'status' => '状态',
        'page' => '页码',
        'pageSize' => '分页大小',
    ];
}

